package com.guangyunl.f_while;
// 用while循环计算出1+2+3的和
public class Demo02While {
    public static void main(String[] args) {
        int i = 1;
        int sum = 0;
        while(i <= 3){
            sum += i;
            i++;
        }
        System.out.println("sum = " + sum); // sum = 6
    }
}
